﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    public class Order
    {
        /// <summary>
        /// 订单号（时间戳+随机码）
        /// </summary>
        [Key]
        [Required]
        [StringLength(32)]
        public string? order_id { get; set; }

        /// <summary>
        /// ⽤户ID
        /// </summary>
        [Required]
        public int user_id { get; set; }

        /// <summary>
        /// ⽀付⽅式（1在线/2货到付款）
        /// </summary>
        [Required]
        public int payment_method { get; set; }

        /// <summary>
        /// 订单总额（含运费）
        /// </summary>
        [Required]
        [StringLength(12)]
        public decimal total_amount { get; set; }

        /// <summary>
        /// 收货地址ID
        /// </summary>
        [Required]
        public int address_id { get; set; }

        /// <summary>
        /// 状态（0待付款/1已⽀付/2已发货/3已完成）
        /// </summary>
        [Required]
        public int order_status { get; set; }

        /// <summary>
        /// 下单时间（按年分区）
        /// </summary>
        [Required]
        public DateTime create_time { get; set; }
    }
}
